package com.suray.wcs.service.enums;

import com.baomidou.mybatisplus.annotation.EnumValue;
import com.baomidou.mybatisplus.core.enums.IEnum;
import com.fasterxml.jackson.annotation.JsonValue;

/**
 * @author shaozn
 */

public enum PriorityMode implements IEnum<Integer> {
    IN(0, "入库优先"),
    OUT(1, "出库优先"),
    BALANCE(2, "出入库均衡"),
    PRIORITY_INSERT_TIME(3, "优先级降序加插入时间升序优先");
    @EnumValue
    private Integer mode;
    @JsonValue
    private String description;

    PriorityMode(int mode, String description) {
        this.mode = mode;
        this.description = description;
    }

    @Override
    public String toString() {
        return description;
    }

    @Override
    public Integer getValue() {
        return mode;
    }


    public static PriorityMode parsePriorityMode(int mode) {
        PriorityMode[] Types = PriorityMode.values();
        for (PriorityMode type : Types) {
            if (type.mode == mode) {
                return type;
            }
        }
        throw new IllegalArgumentException("优先模式参数错误:" + mode);
    }
}
